package com.bruip.ch01;

import java.util.function.Supplier;

/**
 * @author yuxi
 * @version 1.0
 * @date 2025/10/22
 * @Description:
 */
public class Test10_Supplier {
    public static void main(String[] args) {
        Supplier<Integer> supplier = new Supplier<Integer>() {
            @Override
            public Integer get() {
                return (int)(Math.random() * 100+1);
            }
        };
        System.out.println(supplier.get());
        Supplier<Integer> supplier2 = () -> {
            int num;
            do{
                num = (int)(Math.random() * 100+1);
            }while(num%2==0);
            return num;
        };
        for (int i = 0; i < 10; i++) {
            System.out.println(supplier2.get());
        }

    }
}
